package com.wzy.netty.nio;

import java.nio.ByteBuffer;

/**
 * 描述  只读类型
 * 创建人    Wzy
 * 创建时间: 2020-05-20  16:22
 */
public class ReaderBuffer {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(64);
        for (int i = 0; i < 64; i++) {
            buffer.put((byte) i);
        }
        buffer.flip();
        ByteBuffer byteBuffer = buffer.asReadOnlyBuffer();
        System.out.println(buffer.getClass());
        while (byteBuffer.hasRemaining()) {
            System.out.println(byteBuffer.get());
        }
    }
}
